#ifndef H_SD
#define H_SD

#define SD_BA /* define for sd card to use alterantive buffer / input/output */
/* type defines */
#ifndef SD_BA
typedef struct __attribute__ ((packed)){ /* structure to be passed to sdPostData */
  char powerData[12];  /* 0-11 */
  char tempearture[2]; /* 12-13 */
  char time[2];        /* 14-15 */
  char ADCSData[6];    /* 16-21 */
  char payloadData[2]; /* 22-23 */
  char payloadEventID; /* 24 */
  char hash[2];        /* 25-26 */ /* this will be filled in by sdPostData */
  char __padding[5];   /* 27-31 */ /* should always be left blank */
}_sd_record;
#endif /* !SD_BA */
/* external functions */
int sdInit(void);
void sdDisable(void);
void sdEnable(void);
#ifdef SD_BA
#define sdWait sd_wait_notbusy /* to maintain naming standard, sdWait - external, sd_wait_notbusy - internal */
void sd_wait_notbusy(void);
int sd_set_blocklen(unsigned long int length);
int sd_read_block(unsigned long int blockaddr,unsigned char *data);
int sd_write_block(unsigned long int blockaddr,unsigned char *data);
#else
int sdPreData(void);
/* int sdPostData(_sd_record* data); yet to come */
#endif /* SD_BA */
#endif /* H_SD */
